﻿namespace IDAL
{
    /// <summary>
    /// 泛型就是为了实现通用
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseDAL<T>
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> AddRangeAsync(List<T> t);
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> UpateAsync(T t);
        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> UpateRangeAsync(List<T> t);
        /// <summary>
        /// 删除一个
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> DeleteAsync(T t);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> DeleteRangeAsync(List<T> t);
        /// <summary>
        /// 查询所有【预备查，并没有真的到表中查找】
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
    }
}
